﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.Xpo;
namespace ChuanPlus
{
    public class Payment : XPLiteObject
    {
        int fPaymentID;
        [Key(true)]
        public int PaymentID
        {
            get { return fPaymentID; }
            set { SetPropertyValue<int>("PaymentID", ref fPaymentID, value); }
        }
        Order fOrderID;
        [Size(10)]
        public Order OrderID
        {
            get { return fOrderID; }
            set { SetPropertyValue<Order>("OrderID", ref fOrderID, value); }
        }
        [Association("ReceiptVoucher-Payment")]
        ReceiptVoucher fReceiptVoucherID;
        public ReceiptVoucher ReceiptVoucherID
        {
            get { return fReceiptVoucherID; }
            set { SetPropertyValue<ReceiptVoucher>("ReceiptVoucherID", ref fReceiptVoucherID, value); }
        }
        double fAmount;
        public double Amount
        {
            get { return fAmount; }
            set { SetPropertyValue<double>("Amount", ref fAmount, value); }
        }
        string fStatus;
        public string Status
        {
            get { return fStatus; }
            set { SetPropertyValue<string>("Status", ref fStatus, value); }
        }
        public Payment(Session session) : base(session) { }
        public Payment() : base(Session.DefaultSession) { }
        public override void AfterConstruction() { base.AfterConstruction(); }
        /// <summary>
        /// Initializes a new instance of the Payment class.
        /// </summary>
        /// <param name="fOrderID"></param>
        /// <param name="fReceiptVoucherID"></param>
        /// <param name="fAmount"></param>
        public Payment(Order fOrderID, ReceiptVoucher fReceiptVoucherID, double fAmount)
        {
            this.fOrderID = fOrderID;
            this.fReceiptVoucherID = fReceiptVoucherID;
            this.fAmount = fAmount;
            this.fStatus = "P";
        }
        /// <summary>
        /// Initializes a new instance of the Payment class.
        /// </summary>
        /// <param name="fOrderID"></param>
        /// <param name="fReceiptVoucherID"></param>
        /// <param name="fAmount"></param>
        public Payment(Session s, Order fOrderID, ReceiptVoucher fReceiptVoucherID, double fAmount):base(s)
        {
            this.fOrderID = fOrderID;
            this.fReceiptVoucherID = fReceiptVoucherID;
            this.fAmount = fAmount;
            this.Status = "P";
        }
    }

}
